
module.exports = Behavior({
    behaviors: ['wx://form-field-group'],
    properties: {
        name: null,
        value: null,
        placeholder: String,
        option: null
    },
    methods: {
        _changeStart({ detail }){
            let { value } = this.data
            if( !Array.isArray(value) ){ value = []  }
            value = [detail,  value[1] ? value[1] : '' ]
            this.setData({ value })
            this.triggerEvent('change', value)
        },
        _changeEnd({ detail }){
            let { value } = this.data
            if( !Array.isArray(value) ){ value = []  }
            value = [value[0] ? value[0] : '', detail]
            this.setData({ value })
            this.triggerEvent('change', value)
        }
    }
})